﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace TestImport.Model.DatabaseRepositories
{
    public abstract partial class DatabaseRepository
    {
        /*******************************/
        /* LeverancierBesteldAantallen */
        /*******************************/

        public DataTable LeverancierBesteldAantallen_GetData()
        {
            return defaultExecuteReaderDataTable(CommandType.Text, "SELECT boekID, categorieCode, uitgeverCode, isbnNr, titel, auteur, aankoopPrijs, schoolPrijs, huurPrijs, aBoek, boekStatusCode, boeksoortCode, raming, besteldLeerling, besteldPlato, geleverd, teBestellen, isBestelbaarBijPlato, voorraad1, voorraad2, reserve, retourPlato, uitgeverNaam FROM LeverancierBesteldAantallen");
        }

        public DataTable LeverancierBesteldAantallen_GetAfgehaaldAantal(int boekID)
        {
            DataTable dt = new DataTable();
            try
            {
                dbManager.Open();
                dbManager.CreateParameters(1);
                dbManager.AddParameters(0, "@boekID", boekID);
                dbManager.ExecuteReader(CommandType.Text, "SELECT afgehaaldAantal FROM bestellingAfgehaaldAantal WHERE (boekID = @boekID)");
                dt.Load(dbManager.DataReader);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            finally
            {
                dbManager.Dispose();
            }
            return dt;
        }

        public DataTable LeverancierBesteldAantallen_GetBesteldBijPlatoAantal(int boekID)
        {
            DataTable dt = new DataTable();
            try
            {
                dbManager.Open();
                dbManager.CreateParameters(1);
                dbManager.AddParameters(0, "@boekID", boekID);
                dbManager.ExecuteReader(CommandType.Text, "SELECT aantalBesteldBijPlato FROM bestellingBesteldBijPlatoAantal WHERE (boekID = @boekID)");
                dt.Load(dbManager.DataReader);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            finally
            {
                dbManager.Dispose();
            }
            return dt;
        }

        public DataTable LeverancierBesteldAantallen_GetBesteldAantal(int boekID)
        {
            DataTable dt = new DataTable();
            try
            {
                dbManager.Open();
                dbManager.CreateParameters(1);
                dbManager.AddParameters(0, "@boekID", boekID);
                dbManager.ExecuteReader(CommandType.Text, "SELECT besteldAantal FROM bestellingBesteldAantal WHERE (boekID = @boekID)");
                dt.Load(dbManager.DataReader);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            finally
            {
                dbManager.Dispose();
            }
            return dt;
        }

        public DataTable LeverancierBesteldAantallen_GetGeleverdAantal(int boekID)
        {
            DataTable dt = new DataTable();
            try
            {
                dbManager.Open();
                dbManager.CreateParameters(1);
                dbManager.AddParameters(0, "@boekID", boekID);
                dbManager.ExecuteReader(CommandType.Text, "SELECT aantalGeleverd FROM bestellingGeleverdAantal WHERE (boekID = @boekID)");
                dt.Load(dbManager.DataReader);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            finally
            {
                dbManager.Dispose();
            }
            return dt;
        }

        public DataTable LeverancierBesteldAantallen_GetRamingAantal(int boekID)
        {
            DataTable dt = new DataTable();
            try
            {
                dbManager.Open();
                dbManager.CreateParameters(1);
                dbManager.AddParameters(0, "@boekID", boekID);
                dbManager.ExecuteReader(CommandType.Text, "SELECT ramingAantal FROM bestellingRamingAantal WHERE (boekID = @boekID)");
                dt.Load(dbManager.DataReader);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            finally
            {
                dbManager.Dispose();
            }
            return dt;
        }

        public DataTable LeverancierBesteldAantallen_GetRetourNaarPlatoAantal(int boekID)
        {
            DataTable dt = new DataTable();
            try
            {
                dbManager.Open();
                dbManager.CreateParameters(1);
                dbManager.AddParameters(0, "@boekID", boekID);
                dbManager.ExecuteReader(CommandType.Text, "SELECT aantalRetourNaarPlato FROM bestellingRetourNaarPlatoAantal WHERE (boekID = @boekID)");
                dt.Load(dbManager.DataReader);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            finally
            {
                dbManager.Dispose();
            }
            return dt;
        }

    }
}
